home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbasicpg.zip / PHONE.BAS < prev    next >
BASIC Source File  |  1989-08-31  |  692b  |  27 lines

  1. ' PHONE.BAS
  2. ' This program uses a variable-length string array to record names and
  3. '   telephone numbers.
  4.  
  5. OPTION BASE 1             ' set lower bound of array to 1
  6.  
  7. CLS
  8.  
  9. INPUT "How many names would you like to enter?  ", names%
  10. PRINT
  11.  
  12. DIM contacts$(names%, 2)  ' declare array for names and phone numbers
  13.  
  14. FOR i% = 1 TO names%      ' read names into contacts$ array
  15.     INPUT "Enter name:  ", contacts$(i%, 1)
  16.     INPUT "Enter phone number:  ", contacts$(i%, 2)
  17.     PRINT
  18. NEXT i%
  19.  
  20. PRINT "You entered the following contact list:"
  21. PRINT
  22.  
  23. FOR i% = 1 TO names%      ' print contents of array
  24.     PRINT "Name:  "; contacts$(i%, 1), "Phone:  "; contacts$(i%, 2)
  25. NEXT i%
  26.  
  27.